package com.sfh.gd.domain.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 *  赛事报名表
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("gd_game_registration")
public class GameRegistrationDO implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 赛事ID
     */
    private Long gameId;
    /**
     * 会员ID
     */
    private Long userId;

    /**
     * 队伍ID-单人报名为空
     */
    private Long teamId;

    /**
     * 状态 0 已报名 1 已签到 2 已取消 3 禁赛
     */
    private Integer status;
    /**
     * 签到时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime checkinTime;

    /**
     * 创建时间-报名时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

    @Column(onUpdateValue = "LocalDateTime.now()")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime updateTime;

    //会员
    @RelationOneToOne(selfField = "userId", targetField = "id")
    private MemberDO member;

}
